Render snip descriptions as Markdown in the copy flyout#25
Merged
Conversation
Snip descriptions were stored as plain text and never shown on the use-path. Parse them as Markdown in Core (MarkdownParser, backed by Markdig) into a UI-free block/inline model, and render that model to native WinUI inlines via a MarkdownPresenter control in the copy flyout. Supports headings, bold/ italic, inline and block code, links, and ordered/unordered lists. The parsing lives in Core so it's unit-tested without any UI dependency; the App only maps the model onto WinUI primitives. A snip with a description but no parameters now opens the flyout too, so its description is always visible before copying. The editor labels the field as Markdown. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Routing described-but-parameterless snips through the fill flyout regressed
copy for templates containing bare {token} text: with no declared parameters
the engine left the token unresolved and IsCopyEnabled stayed false, so the
snip could no longer be copied (the direct path had copied it verbatim).
Gate copy on full resolution only when there are parameters to fill; with
none, the template copies verbatim as before. Capture the parameter presence
in a field since a defaulted input fires its change callback during
construction, before Inputs is assigned.
Found by codex review.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the Markdown rendering for Snip descriptions carried-over item. Descriptions were stored as plain text and never surfaced on the use-path; they now render as Markdown in the copy flyout.
Approach (Markdig in Core, per the agreed design)
There's no clean first-party markdown control for our WASDK 2.1 / net10 stack (the 7.x toolkit
Markdowncontrol risks conflicting with the 8.x toolkit; the newer Markdig-based control isn't shipped stable). So:MarkdownParser(backed by Markdig, latest stable) walks the AST into a small UI-free model (MarkdownBlock/MarkdownInline— paragraphs, headings, code blocks, lists; runs with bold/italic/code flags, links, line breaks). This is unit-tested with no UI dependency, matching the Core/App discipline.MarkdownPresenter(a self-buildingStackPanel) maps the model onto native WinUI inlines/elements —Run/Hyperlink/LineBreak, monospace code, bordered code blocks, bulleted/numbered lists. No new UI dependency; Markdig flows transitively into the App via the Core project reference.UX
Tests
MarkdownParserTests(blank input, paragraphs, bold/italic/inline-code flags, headings, fenced code, ordered/unordered lists, links, hard breaks).🤖 Generated with Claude Code